<!--
 * @Descripttion:
 * @Author: peter.pan
 * @Date: 2022-12-12 10:06:17
 * @LastEditors: peter.pan
 * @LastEditTime: 2022-12-12 12:05:20
-->
<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="card">
      <el-tab-pane label="基本信息" name="basic">
        <BasicInfo
          v-if="activeName === 'basic'"
          ref="BsaicInfo"
          mode="single"
        />
      </el-tab-pane>
      <el-tab-pane label="实例信息" name="instance">
        <InstanceInfo v-if="activeName === 'instance'" mode="single" />
      </el-tab-pane>
      <el-tab-pane label="实时监控" name="monitor">
        <ActualMonitor v-if="activeName === 'monitor'" mode="single" />
      </el-tab-pane>
      <el-tab-pane label="规则配置" name="rule">
        <RuleInfo v-if="activeName === 'rule'" mode="single" />
      </el-tab-pane>
    </el-tabs>

    <el-button
      v-show="activeName === 'basic'"
      type="primary"
      icon="el-icon-edit"
      class="edti-btn"
      size="small"
      @click="editDetail"
    >
      编辑
    </el-button>
  </div>
</template>

<script>
import BasicInfo from './components/BasicInfo.vue'
import ActualMonitor from '../monitor'
import InstanceInfo from '../instance'
import RuleInfo from '../rule'

export default {
  components: {
    BasicInfo,
    ActualMonitor,
    InstanceInfo,
    RuleInfo
  },
  data() {
    return {
      activeName: this.$route.query.activeName || 'basic'
    }
  },
  methods: {
    editDetail() {
      this.$refs.BsaicInfo.openEdit()
    }
  }
}
</script>

<style lang="scss" scoped>
  .app-container {
    position: relative;

    .edti-btn {
      position: absolute;
      right: 35px;
      top: 20px;
    }
  }
</style>
